﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Abp.Application.Services;
using Abp.Application.Services.Dto;
using LeadThing.AbpZeroTemplate.Areas.Dtos;
using LeadThing.AbpZeroTemplate.Dto;

namespace LeadThing.AbpZeroTemplate.Areas
{
    /// <summary>
    /// 地区服务接口
    /// </summary>
    public interface IAreaAppService : IApplicationService
    {
        #region 地区管理

        /// <summary>
        /// 根据查询条件获取地区分页列表
        /// </summary>
        Task<PagedResultDto<AreaListDto>> GetPagedAreasAsync(GetAreaInput input);

        /// <summary>
        /// 通过Id获取地区信息进行编辑或修改 
        /// </summary>
        Task<GetAreaForEditOutput> GetAreaForEditAsync(NullableIdDto<long> input);

        /// <summary>
        /// 通过指定id获取地区ListDto信息
        /// </summary>
        Task<AreaListDto> GetAreaByIdAsync(EntityDto<long> input);



        /// <summary>
        /// 新增或更改地区
        /// </summary>
        Task CreateOrUpdateAreaAsync(CreateOrUpdateAreaInput input);





        /// <summary>
        /// 新增地区
        /// </summary>
        Task<AreaEditDto> CreateAreaAsync(AreaEditDto input);

        /// <summary>
        /// 更新地区
        /// </summary>
        Task UpdateAreaAsync(AreaEditDto input);

        /// <summary>
        /// 删除地区
        /// </summary>
        Task DeleteAreaAsync(EntityDto<long> input);

        /// <summary>
        /// 批量删除地区
        /// </summary>
        Task BatchDeleteAreaAsync(List<long> input);

        #endregion

        #region Excel导出功能

        /// <summary>
        /// 获取地区信息转换为Excel
        /// </summary>
        /// <returns></returns>
        Task<FileDto> GetAreaToExcel();

        #endregion

        #region 扩展方法

        /// <summary>
        /// 根据层级统计特殊人群人数
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        List<AreaFileListDto> GetSumSpecialPersonLoadPage(GetAreaInput input);

        /// <summary>
        /// 根据层级统计矛盾纠纷人数
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        List<AreaFileListDto> GetSumPersonByLevelLoadPage(GetAreaInput input);

        /// <summary>
        /// 根据层级统计网格人口
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        List<AreaFileListDto> GetPersonPercentageByLevelLoadPage(GetAreaInput input);

        /// <summary>
        /// 根据条件获取地区数据加载页面数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        PagedResultDto<AreaFileListDto> GetAreaByWhereAsyncLoadPage(GetAreaInput input);

        /// <summary>
        /// 根据条件获取地区数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<ListResultDto<AreaFileListDto>> GetAreaByWhereAsync(GetAreaInput input);

        /// <summary>
        /// 获取全部地区
        /// </summary>
        /// <returns></returns>
        Task<ListResultDto<AreaListDto>> GetAreas();

        /// <summary>
        /// 获取全部地区树形数据
        /// </summary>
        /// <returns></returns>
        List<ComboboxItemDto> GetAreaTree();

        /// <summary>
        /// 根据层级获取地区数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<ListResultDto<AreaListDto>> GetAreaByLevelAsync(GetAreaInput input);

        /// <summary>
        /// 根据摄像头ID获取区域及其 乡镇、社区、村庄ID
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<AreaDto> GetAreaByCameraIdAsync(GetAreaInput input);

        /// <summary>
        /// 根据父id获取子节点数量
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<PagedResultDto<AreaListDto>> GetAreaByParentIdAsync(EntityDto<long> input);
        #endregion

        #region IOS

        /// <summary>
        /// 根据层级获取地区数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<ListResultDto<AreaListDto>> GetAreaByLevelAsyncIOS(GetAreaIOSInput input);

        #endregion

    }
}
